/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistencia;

import java.sql.Connection;
import java.util.List;
import negocio.Tabela;
import negocio.Coluna;


/**
 *
 * @author v3550
 */
public class PersistenciaFachada {


    DaoConnection daoConexao;
    DaoExecuteQuery daoQuery;

    public PersistenciaFachada() {
        daoConexao = new DaoConnection();
    }
 
    public Connection setConexao(String user, String pass, String host, String port, String sid) throws Exception {
        Connection conn = daoConexao.setConnection(user, pass, host, port, sid);
        if(conn != null)
        {
            daoQuery = new DaoExecuteQuery(conn);
            daoQuery.populaOwner();
        }    
        return conn;
    }

    
    public void fecharConexao() throws Exception {
        daoConexao.closeConnection();
    }

    public List<Tabela> getListaTabelas(String owner) throws Exception{
        return daoQuery.getTabelas(owner);
    }

   public List<String> getListaOwner() throws Exception{
         return daoQuery.getListOwners();
    }

    public List<Coluna> getColunas(String owner, String table) throws Exception{
         return daoQuery.getColunas(owner, table);
    }

    public boolean gravarNoDicionario(Tabela d) throws Exception{
        return daoQuery.gravarNoDicionario(d);
    }

    public Tabela recuperarDicionario( String owner, String tabela) throws Exception  
    {
       return daoQuery.recuperarDoDicionario(owner, tabela);
    }
    
    public void calculoVolumetrico(String owner) throws Exception
    {
        daoQuery.calculoVolumetrico(owner);
    }
}
